-- ======================================================================
-- Hell Lua Bus
-- 
-- Copyright 2012-2013Hell-Prototypes
--
-- http://www.hellprototypes.com/
--
-- This is free software, licensed under the terms of the GNU General
-- Public License as published by the Free Software Foundation.
-- ======================================================================
iic = require "mod_fw_iic"

if not iic.device_open() then
	print("iic.device_open fail")
	return
end

iic.io_init()
iic.device_addr(0x3a)

t = iic.read_regs(0, 12)
if #t > 0 then
	print("iic.read_regs() ret size = " .. #t)
	x = t[1] + t[2]*256
	y = t[3] + t[4]*256
	z = t[5] + t[6]*256

	print("X = ",  x)
	print("Y = ",  y)
	print("Z = ",  z)
else
	print("Read regs Error")
end
		
if not iic.device_close() then
	print("iic.device_close fail")
end
